/*
 * @Author: hx 2542123711@QQ.com
 * @Date: 2024-11-26 19:01:12
 * @LastEditors: hx 2542123711@QQ.com
 * @LastEditTime: 2024-11-26 19:04:17
 * @FilePath: /class_process-signal/myprocess.cc
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include<iostream>
#include<unistd.h>
#include<signal.h>

using namespace std;

void myhander(int signo)
{
    cout << "signo: " << signo <<endl;
    exit(1);
}

int main()
{

    signal(SIGINT, myhander);
    while(true)
    {
        cout << "I am a  crazy process: " << getpid() << endl;
        sleep(1);
    }
    return 0;
}